<div class="bg-light lter b-b wrapper-md">
    <h4 class="m-n font-thin">角色管理</h4>
    <!--<button ui-sref="app.role" class="btn-back btn btn-dark btn-sm btn-rounded">-->
        <!--返回-->
    <!--</button>-->
</div>
<div class="wrapper-md ng-scope" ng-controller="createRoleCtrl">
    <div class="panel panel-default">
        <div class="panel-heading font-bold">
            创建角色
        </div>
        <div class="panel-body">
            <form class="form-horizontal form-validation" method="post" ng-submit="createRole()">
                <div class="form-group">
                    <label class="col-sm-2 control-label font-bold">名称</label>
                    <div class="col-sm-5">
                        <input ng-model="role.name" type="text" class="form-control" placeholder="请输入角色名称" required>
                    </div>
                </div>
                <div class="form-group" ng-if="app.session.isSys==1">
                    <label class="col-sm-2 control-label font-bold">是否系统角色</label>
                    <div class="col-sm-5">
                        <div class="pull-left">
                            <label class="pull-left i-switch m-t-xs m-r">
                                <input type="checkbox" ng-model="role.isSys" ng-true-value="1" ng-false-value="0">
                                <i></i>
                            </label>
                        </div>
                        <label class="pull-left m-t-xs font-bold" ng-bind="{0:'关闭',1:'开启'}[role.isSys]">开启</label>
                    </div>
                </div>
                <div class="form-group" ng-if="role.platform==2">
                    <label class="col-sm-2 control-label font-bold">是否公共角色</label>
                    <div class="col-sm-5">
                        <div class="pull-left">
                            <label class="pull-left i-switch m-t-xs m-r">
                                <input type="checkbox" ng-model="role.isCommon" ng-true-value="1" ng-false-value="0">
                                <i></i>
                            </label>
                        </div>
                        <label class="pull-left m-t-xs font-bold" ng-bind="{0:'关闭',1:'开启'}[role.isCommon]">开启</label>
                    </div>
                </div>
                <div class="form-group" ng-if="role.platform==0 && app.session.isSys==1">
                    <label class="col-sm-2 control-label font-bold">是否商户默认角色</label>
                    <div class="col-sm-5">
                        <div class="pull-left">
                            <label class="pull-left i-switch m-t-xs m-r">
                                <input type="checkbox" ng-model="role.isDefault" ng-true-value="1" ng-false-value="0">
                                <i></i>
                            </label>
                        </div>
                        <label class="pull-left m-t-xs font-bold" ng-bind="{0:'关闭',1:'开启'}[role.isCommon]">开启</label>
                    </div>
                </div>

                <div class="form-group" ng-if="role.platform==0 && app.session.isSys==1 && role.isDefault==1">
                    <label class="col-sm-2 control-label font-bold">默认角色类型</label>
                    <div class="col-sm-5">
                        <div class="inline m-r-xs">
                            <div class="radio inline m-r-n">
                                <label class="i-checks i-checks-sm">
                                    <input type="radio" name="defaultType" ng-model="role.defaultType" value="0">
                                    <i></i>
                                </label>
                            </div>
                            <p class="font-bold inline m-n">默认单商户角色</p>
                            <i class="inline m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top" popover="普通角色" popover-trigger="mouseenter"></i>
                        </div>
                        <div class="inline m-r-xs">
                            <div class="radio inline m-r-n">
                                <label class="i-checks i-checks-sm">
                                    <input type="radio" name="defaultType" ng-model="role.defaultType" value="1">
                                    <i></i>
                                </label>
                            </div>
                            <p class="font-bold inline m-n">默认连锁品牌角色</p>
                            <i class="inline m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top" popover="默认单商户角色" popover-trigger="mouseenter"></i>
                        </div>
                        <div class="inline m-r-xs">
                            <div class="radio inline m-r-n">
                                <label class="i-checks i-checks-sm">
                                    <input type="radio" name="defaultType" ng-model="role.defaultType" value="2">
                                    <i></i>
                                </label>
                            </div>
                            <p class="font-bold inline m-n">默认单商户独立小程序角色</p>
                            <i class="inline m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top" popover="默认单商户独立小程序角色" popover-trigger="mouseenter"></i>
                        </div>
                        <div class="inline m-r-xs">
                            <div class="radio inline m-r-n">
                                <label class="i-checks i-checks-sm">
                                    <input type="radio" name="defaultType" ng-model="role.defaultType" value="3">
                                    <i></i>
                                </label>
                            </div>
                            <p class="font-bold inline m-n">默认连锁品牌角色下商户角色</p>
                            <i class="inline m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top" popover="默认连锁品牌角色下商户角色" popover-trigger="mouseenter"></i>
                        </div>
                    </div>
                </div>


                <div class="form-group">
                    <label class="col-sm-2 control-label font-bold">平台类型</label>
                    <div class="col-sm-5">
                        <div class="inline m-r-xs">
                            <div class="radio inline m-r-n">
                                <label class="i-checks i-checks-sm">
                                    <input type="radio" name="platform" ng-model="role.platform" value="0" ng-click="role.isCommon=1" class="ng-pristine ng-untouched ng-valid">
                                    <i></i>
                                </label>
                            </div>
                            <p class="font-bold inline m-n">商户</p>
                            <i class="inline m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top" popover="添加的商户角色默认为公共角色,商户无法修改" popover-trigger="mouseenter"></i>
                        </div>
                        <div class="inline m-r-xs">
                            <div class="radio inline m-r-n">
                                <label class="i-checks i-checks-sm">
                                    <input type="radio" name="platform" ng-model="role.platform" value="1" ng-click="role.isCommon=1" class="ng-pristine ng-untouched ng-valid">
                                    <i></i>
                                </label>
                            </div>
                            <p class="font-bold inline m-n">城市代理</p>
                            <i class="inline m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top" popover="添加的城市角色默认为公共角色,城市无法修改" popover-trigger="mouseenter"></i>
                        </div>
                        <div class="inline m-r-xs">
                            <div class="radio inline m-r-n">
                                <label class="i-checks i-checks-sm">
                                    <input type="radio" name="platform" ng-model="role.platform" value="2" ng-click="role.isCommon=0" class="ng-pristine ng-untouched ng-valid">
                                    <i></i>
                                </label>
                            </div>
                            <p class="font-bold inline m-n">总部</p>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label font-bold">描述</label>
                    <div class="col-sm-5 pos-rlt">
                        <textarea class="form-control" rows="6" ng-model="role.description" maxlength="100" placeholder="请输入角色描述(描述内容不超过100字)"></textarea>
                    </div>
                </div>

                <div class="line line-dashed b-b line-lg pull-in"></div>
                <div class="form-group">
                    <div class="col-sm-4 col-sm-offset-2">
                        <button type="submit" class="btn btn-success">保存</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>